﻿using System.Collections;
using System.Collections.Generic;
using GameFramework.Fsm;
using UnityEngine;

namespace StarForce {
    public class CardDiableState : BasicCardState
    {
        public CardDiableState(Card handler, UiCardParameters parameters) : base(handler, parameters) {
        }

        protected override void OnEnter(IFsm<Card> fsm) {
            base.OnEnter(fsm);
            Disable();
            Hander.Hand.OnCardUnSelect += OnCardUnSelect;
            Hander.Hand.OnCardPlay += OnCardPlay;
        }

        protected override void OnLeave(IFsm<Card> fsm, bool isShutdown) {
            Hander.Hand.OnCardUnSelect -= OnCardUnSelect;
            Hander.Hand.OnCardPlay -= OnCardPlay;
            base.OnLeave(fsm, isShutdown);
        }

        private void OnCardUnSelect() {
            ChangeState<CardIdleState>(Fsm);
        }

        private void OnCardPlay(Card card) {
            ChangeState<CardIdleState>(Fsm);
        }
    }
}

